/*
 * @Author: chenyunye C18025010782@163.com
 * @Date: 2023-02-17 10:46:58
 * @LastEditors: chenyunye C18025010782@163.com
 * @LastEditTime: 2023-03-08 20:00:39
 * @FilePath: \vue-qiankun-master\src\store\modules\check.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
const tokenPlugin = (store) => {
  console.log("刷新页面");
  let token = localStorage.getItem("master-token");
  if (token) {
    store.commit("setToken", token);
  }
};
export default {
  state: {
    token: "",
  },
  mutations: {
    setToken(state, token) {
      console.log(token,'token');
      state.token = token;
      localStorage.setItem("token", token);
    },
    loginOut(state) {
      state.token = "";
      localStorage.removeItem("token");
    },
    tokenPlugin(store) {
      let token = localStorage.getItem("token");
      if (token) {
        store.commit("setToken", token);
      }
    },
  },
};
